import state from "./state";

export default {
time(){
  // duration=state.musicTimeProcess.duration
  // min=parseInt(state.musicTimeProcess.duration/60)
  // current=parseInt(state.musicTimeProcess.currentTime)
  // let min1=min>9?min:'0'+min
  // let second1=duration%60>9?duration:'0'+duration;

  // let rightTime=min1+':'+second1;
  // let min2=
if(state.musicTimeProcess){
  let t=new Date(parseInt(state.musicTimeProcess.duration*1000))
  let c=new Date(parseInt(state.musicTimeProcess.currentTime*1000))
  let m=t.getMinutes()<10?'0'+t.getMinutes():t.getMinutes()
  let s=t.getSeconds()<10?'0'+t.getSeconds():t.getSeconds()
  let duration=m+':'+s
  let m2=c.getMinutes()<10?'0'+c.getMinutes():c.getMinutes()
  let s2=c.getSeconds()<10?'0'+c.getSeconds():c.getSeconds()
  let current=m2+':'+s2
  return {current:current,duration:duration}
}
}

}